/**
 * 
 */
package com.rpg.base;

import com.module.hq.engine.HQInteractiveObject;
import com.rpg.base.interactive.flyweight.BaseInteractiveObject;

/**
 * @author Donald
 */
public interface Script<IO> {
	void addToGroup(IO io, String group);
	void eventStackClear();
	void eventStackClearForIo(IO io);
	void eventStackExecute() throws Exception;
	void eventStackExecuteAll() throws Exception;
	void eventStackInit();
	/**
	 * Gets the EVENT_SENDER global.
	 * @return {@link BaseInteractiveObject}
	 */
	IO getEventSender();
	IO getIOMaxEvents() throws Exception;
	IO getIOMaxEventsSent() throws Exception;
	/**
	 * Determines if an IO is in a specific group.
	 * @param io the IO
	 * @param group the group name
	 * @return true if the IO is in the group; false otherwise
	 */
	boolean isIOInGroup(HQInteractiveObject io, String group);
	void releaseAllGroups(IO io);
	/**
	 * Sends a script event to an interactive object. The returned value is a 
	 * flag indicating whether the event was successful or refused.
	 * @param target the reference id of the targeted io
	 * @param msg the message being sent
	 * @param params the list of parameters applied.
	 * @param eventname the name of the event
	 * @return <code>int</code>
	 * @throws Exception if an error occurs
	 */
	int sendIOScriptEvent(IO target, int msg, Object[] params,
			String eventname) throws Exception;
	int sendMsgToAllIO(int msg, Object[] dat) throws Exception;
	/**
	 * Sets the EVENT_SENDER global.
	 * @param newSender the new event sender
	 */
	void setEventSender(IO newSender);
	void timerClearAll();
	void timerClearForIO(IO io);
	// void releaseScript(SCRIPT es);
	void timerFirstInit(int number);
}
